package com.ethan.java8;

import java.util.Optional;

/**
 * @author ethan
 * create 2018-08-03 上午10:52
 * desc
 **/
public class Test4 {
    public static void main(String[] args) {
        //Optional
        Optional<String> fullName = Optional.ofNullable(null);
        System.out.println("Full Name is set?" + fullName.isPresent());
        System.out.println("Full Name:" + fullName.orElseGet(() -> "[none]"));
        System.out.println(fullName.map(m -> "Hey" + m + "!").orElse("Hey Stranger"));

    }
}
